﻿<?php
  @header("content-Type: text/html; charset=utf-8"); //ԯҔǿ׆
  
	$orgNames = array();
	$orgNames[0]="基金";
	$orgNames[1]="社保基金";
	$orgNames[2]="保险";
	$orgNames[3]="客户信用交易担保证券账户";
	$orgNames[4]="集合资产管理计划";
	
	$orgType = urldecode($_GET['orgType']);
  if (empty($orgType)){
  	$orgType = 0;
  } 
  
  $orgName = $orgNames[(int)$orgType];
  
  $specialTitle = $orgName.'买了什么股';
  
	require_once('head.php');
?>

<link rel="stylesheet" href="/css/table.css" type="text/css"/>

<script type="text/javascript">
	$(document).ready(function(){
		$("a").each(function(){
			$(this).click(function(){
				$(this).css("font-size","larger");
				$(this).css("background-color","red");
			})
		})
	});
</script>		  

  <div class="hang1">
    <img src="/images/listPrefix.gif"><a id="innerNav60" href="http://www.gudahu.com/topOrg.php?orgType=0" target="_self">基金</a>
    <img src="/images/listPrefix.gif"><a id="innerNav002" href="http://www.gudahu.com/topOrg.php?orgType=2" target="_self">保险</a>
    <img src="/images/listPrefix.gif"><a id="innerNav30" href="http://www.gudahu.com/topOrg.php?orgType=3" target="_self">客户信用交易担保证券账户</a>
    <img src="/images/listPrefix.gif"><a id="innerNav30" href="http://www.gudahu.com/topOrg.php?orgType=4" target="_self">集合资产管理计划</a> 
  </div>


<table class="t1"> 
<thead><th>股票代码</th><th>股票名称</th><th>股东</th><th>占股数量</th><th>占股比例</th></thead>
 
<?php
  // Connect to the database 
  $dbc = mysqli_connect('localhost', 'root', 'k00l@1D;', 'gudahu')
    or die('Error connecting to MySQL server.');
	mysqli_set_charset($dbc, 'utf8');
  // Retrieve the score data from MySQL
  
$query = "select th.stock_code, s.name, th.holder_name, th.share_amount, th.share_ratio FROM top_holder th inner join stock s on th.stock_code = s.code where th.appear_date = '2013-03-31' and th.holder_name like '%".$orgName."%' order by th.share_ratio desc limit 100";
  $result = mysqli_query($dbc, $query)
    or die('Error querying database.');
    
  $isLine2 = false;
  $seq = 1;
  while ($row = mysqli_fetch_array($result)) {   	  
  	  if ($isLine2) {
  	  	echo '<tr class="a1">';
  	  	$isLine2 = false;
  	  } else {
  	  	echo '<tr>';
  	  	$isLine2 = true;
  	  }
  	  
      echo '<td><a target="_blank" href="http://www.gudahu.com/topHolderDetail.php?code='.$row['stock_code'].'">'.$row['stock_code'].'</a></td>';
      echo '<td>'.$row['name'].'</td>';
      echo '<td>'.$row['holder_name'].'</td>';
      echo '<td>'.$row['share_amount'].'</td>';
      echo '<td>'.$row['share_ratio'].'%</td>';
      echo '</tr>';
      $seq++;
  }	
  				    
  mysqli_close($dbc);
?>

</table>

<?php
	require_once('foot.php');
?>  